package com.gameapplet.PlayStatus.service.Impl;

import com.gameapplet.PlayStatus.dao.IPlayStatusDao;
import com.gameapplet.PlayStatus.model.PlayStatus;
import com.gameapplet.PlayStatus.service.IPlayStatusService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("playStatusServices")
public class PlayStatusServiceImpl implements IPlayStatusService{
    @Resource(name="iPlayStatusDao")
    IPlayStatusDao iPlayStatusDao;

    public void savePlayStatus(PlayStatus playStatus){
        iPlayStatusDao.insertPlayStatus(playStatus);
    }

    @Override

    public PlayStatus findPlaytatus(String playstatusid){
      PlayStatus playStatus =  iPlayStatusDao.selectplaytatus(playstatusid);
        return playStatus;
    }

    @Override
    public List<PlayStatus> getRankList(String stageid){
        return iPlayStatusDao.selectranklist(stageid);
    }

    public PlayStatus selectUserMax(String openid, String stageid) {
        return iPlayStatusDao.selectUserMax(openid,stageid);
    }
    public  void  updateismax(String openid,String stageid,Double thisScore){
        iPlayStatusDao.udpateismax(openid,stageid,thisScore);
    }

    @Override
    public PlayStatus selectLastStageRanklist(Double thisScore, String openid, String stageid) {
        return iPlayStatusDao.selectLastStageRanklist(thisScore,openid,stageid);
    }

    @Override
    public PlayStatus selectLastTwoStageRanklist(Double thisScore, String openid, String stageid) {
        return iPlayStatusDao.selectLastTwoStageRanklist(thisScore, openid, stageid);
    }

    @Override
    public PlayStatus selectNextStageRanklist(Double thisScore, String openid, String stageid) {
        return iPlayStatusDao.selectNextStageRanklist(thisScore, openid, stageid);
    }

    @Override
    public PlayStatus selectNextTwoStageRankList(Double thisScore, String openid, String stageid) {
        return iPlayStatusDao.selectNextTwoStageRanklist(thisScore, openid, stageid);
    }

    @Override
    public int selectCurrentStage(String openid) {
        return iPlayStatusDao.selectCurrentStage(openid);
    }


}
